Skip to content

Update OpenApi implementation to avoid reflection#1185

Closed
Youssef1313 wants to merge 4 commits into
dotnet:mainfrom
Youssef1313:dev/ygerges/no-refl
Closed

Update OpenApi implementation to avoid reflection#1185
Youssef1313 wants to merge 4 commits into
dotnet:mainfrom
Youssef1313:dev/ygerges/no-refl

Conversation

@Youssef1313
Copy link
Copy Markdown
Member

@Youssef1313 Youssef1313 commented May 11, 2026

No description provided.

@Youssef1313 Youssef1313 force-pushed the dev/ygerges/no-refl branch from a8d358d to 53e1275 Compare May 11, 2026 20:17
@Youssef1313 Youssef1313 force-pushed the dev/ygerges/no-refl branch from 53e1275 to 0a59d0b Compare May 11, 2026 20:22
@Youssef1313 Youssef1313 force-pushed the dev/ygerges/no-refl branch from 0a59d0b to bde8d62 Compare May 11, 2026 20:30
Comment on lines +7 to +8
<OpenApiGenerateDocuments>false</OpenApiGenerateDocuments>
<OpenApiGenerateDocumentsOnBuild>false</OpenApiGenerateDocumentsOnBuild>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case build-time generation was previously broken already (which I would expect it to), then the package should set these by default.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was definitely working before

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know. I'll continue investigations then.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. I updated PR description. It's working already on main and I'll try to look how can I make it work with the changes in this PR.

@commonsensesoftware
Copy link
Copy Markdown
Collaborator

Build-time generation does work. The example OpenAPI projects have this enabled and will generate the document on build. If you find this not to be the case and can provide some more details, I can help troubleshoot.

@Youssef1313
Copy link
Copy Markdown
Member Author

Youssef1313 commented May 12, 2026

Hi @commonsensesoftware

Can you please validate with the latest changes how well the implementation here works? And whether the implementation is satisfying and looks good to you?

@Youssef1313 Youssef1313 force-pushed the dev/ygerges/no-refl branch from 6c71497 to c8851a1 Compare May 12, 2026 14:55
@Youssef1313 Youssef1313 force-pushed the dev/ygerges/no-refl branch from c8851a1 to 888f90e Compare May 12, 2026 14:56
semaphore.Wait();
try
{
if ( initialized || !isReady )
if ( descriptor.ServiceType.FullName == "Microsoft.Extensions.ApiDescriptions.IDocumentProvider" )
{
return descriptor;
}
Comment on lines +92 to +98
{
return descriptor;
}
}

if ( GetJsonConfiguration() is { } descriptor )
throw new UnreachableException();
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Youssef1313 Overall, it's looking solid to me. I'll see if I can't pull down these changes and test it out tonight. Thanks for the assist.

@Youssef1313 Youssef1313 force-pushed the dev/ygerges/no-refl branch from f520deb to b492d06 Compare May 13, 2026 18:13
@Youssef1313
Copy link
Copy Markdown
Member Author

Looks like I broke build-time generation while fixing some test failure. Things feel so fragile so far.

@commonsensesoftware
Copy link
Copy Markdown
Collaborator

Yeah ... these things can be yucky. I appreciate the assist. Let me know if there's anything you need.

@Youssef1313
Copy link
Copy Markdown
Member Author

Replaced with #1186

Attempting to replace service provider or doing anything similar is extremely fragile.

@Youssef1313 Youssef1313 deleted the dev/ygerges/no-refl branch May 15, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants